package emulator.support;

import emulator.hardware.HwByte;
import emulator.hardware.HwWord;
import emulator.util.MemoryPtr;

public class DisplacementOperandEval implements OperandEval {
	MemoryPtr instruction;

	public DisplacementOperandEval(MemoryPtr ptr) {
		instruction = ptr;
	}

	@Override
	public String getDetails(CpuState cpu_state) {
		int offset = instruction.getByteOp();
		int target = instruction.getRelativeOp();
		return "PC + $"+new HwByte(offset)+" -> $"+new HwWord(target);
	}

	@Override
	public boolean isAddress() {
		return false;
	}

	@Override
	public int getAddress(CpuState cpu_state) {
		return instruction.getRelativeOp();
	}

	@Override
	public boolean isIndirect() {
		return false;
	}
}
